import type { Univer } from '@univerjs/core'
import { UniverThreadCommentPlugin } from '@univerjs/thread-comment'
import { UniverSheetsThreadCommentBasePlugin } from '@univerjs/sheets-thread-comment-base'
import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment'
import { IThreadCommentMentionDataService, UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui'

export function setupComment(univer: Univer) {
  const defaultIcon = ''

  // Custom mention data service
  class CustomMentionDataService implements IThreadCommentMentionDataService {
    trigger = '@'
    async getMentions() {
      return [
        {
          id: '1',
          label: 'User1',
          type: 'user',
          icon: defaultIcon,
        },
        {
          id: '2',
          label: 'User2',
          type: 'user',
          icon: defaultIcon,
        },
      ]
    }
  }

  univer.registerPlugin(UniverThreadCommentPlugin)
  univer.registerPlugin(UniverSheetsThreadCommentBasePlugin)
  univer.registerPlugin(UniverThreadCommentUIPlugin, {
    overrides: [[IThreadCommentMentionDataService, { useClass: CustomMentionDataService }]],
  })
  univer.registerPlugin(UniverSheetsThreadCommentPlugin)
}
